const createFragmentFromTemplate = (htmlString: string): DocumentFragment => {
  const holder: HTMLDivElement = document.createElement('div');
  holder.innerHTML = htmlString;

  const fragment: DocumentFragment = document.createDocumentFragment();
  while (holder.firstChild) {
      fragment.appendChild(holder.firstChild);
  }

  return fragment;
};

export default createFragmentFromTemplate;
